package com.student.controller;

import com.student.entity.Student;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.lang.invoke.MethodType;
import java.util.List;
import java.util.Map;

/**
 * Created by zhudong on 2016/9/12.
 */
public class StudentController {

    @RequestMapping("/students")
    public String list(@RequestParam(value = "page",required = false)Integer page,
                       Map<String,Object> map){

        return "list";
    }

    @RequestMapping(value = "/student",method = RequestMethod.GET)
    public String newStudent(Map<String,Object> map){
        map.put("student",new Student());
        return "input";
    }

    @RequestMapping(value = "/student",method = RequestMethod.POST)
    public String create(Student student){
        return "redirect:/students";
    }

    @RequestMapping(value = "/student/{id}",method = RequestMethod.DELETE)
    public String delete(@PathVariable("id") Integer id){
        return "redirect:/students";
    }

//    @RequestMapping(value = "/student/{id}",method = RequestMethod.GET)
//    public String edit(@PathVariable("id")Integer id,Map<String,Object> map){
//        map.put("student",studentService.get(id));
//        return "input";
//    }




}
